package cn.iocoder.yudao.module.call.dal.mysql.listenaction;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.call.dal.dataobject.listenaction.ListenActionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.call.controller.admin.listenaction.vo.*;

/**
 * 外呼任务动作绑定 Mapper
 *
 * @author 数创万维
 */
@Mapper
public interface ListenActionMapper extends BaseMapperX<ListenActionDO> {

    default PageResult<ListenActionDO> selectPage(ListenActionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ListenActionDO>()
                .eqIfPresent(ListenActionDO::getSource, reqVO.getSource())
                .eqIfPresent(ListenActionDO::getSourceId, reqVO.getSourceId())
                .eqIfPresent(ListenActionDO::getListen, reqVO.getListen())
                .eqIfPresent(ListenActionDO::getAction, reqVO.getAction())
                .betweenIfPresent(ListenActionDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ListenActionDO::getStatus, reqVO.getStatus())
                .orderByDesc(ListenActionDO::getId));
    }

}